<{include file="admin/header.html"}>
<script charset="utf-8" src="/resources/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/resources/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript">
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('textarea[name="text"]', {
            allowFileManager : true
        });

    });

    $(document).ready(function(){ // 当页面加载完毕的时候

        $('#slug').blur(function(){ // “检查用户名重复”的按钮被点击
            // 由于需要JSON数据，所以使用$.getJSON
            $.getJSON("<{spUrl c=post a=check}>", { 'slug': $('#slug').val() }, function(json){
                // 这里是返回的数据，json变量就是json格式的数据，可以直接使用
                //alert("JSON 结果: " + json.status); // 使用json.status，对应myajax/check中的$result['status']
                $('#exresult').html(json.message); // 使用json.message，对应myajax/check中的$result['message']
            });
        });

    });
</script>

<ul id="main-nav">  <!-- Accordion Menu -->

    <li>
        <a href="<{spUrl c=admin a=index}>" class="nav-top-item no-submenu">控制面板</a>
    </li>

    <li>
        <a href="#" class="nav-top-item current">文章</a>
        <ul>
            <li><a class="current" href="<{spUrl c=post a=write}>">撰写新文章</a></li>
            <li><a href="<{spUrl c=post a=index}>">文章管理</a></li>
            <li><a href="<{spUrl c=category a=index}>">分类管理</a></li>
        </ul>
    </li>

    <li>
        <a href="#" class="nav-top-item">页面和区块</a>
        <ul>
            <li><a href="<{spUrl c=page a=write}>">撰写新页面</a></li>
            <li><a href="<{spUrl c=area a=write}>">撰写新区块</a></li>
            <li><a href="<{spUrl c=page a=index}>">页面管理</a></li>
            <li><a href="<{spUrl c=area a=index}>">区块管理</a></li>
        </ul>
    </li>

    <li>
        <a href="#" class="nav-top-item">设置</a>
        <ul>
            <li><a href="<{spUrl c=user a=edit uid=$smarty.session.userinfo.uid}>">个人信息</a></li>
            <li><a href="<{spUrl c=user a=index}>">用户和权限</a></li>
        </ul>
    </li>

</ul> <!-- End #main-nav -->

</div></div> <!-- End #sidebar -->

<div id="main-content"> <!-- Main Content Section with everything -->

    <div class="content-box"><!-- Start Content Box -->

        <div class="content-box-header">

            <h3>编辑文章</h3>

        </div> <!-- End .content-box-header -->

        <div class="content-box-content">

            <form id="form1" name="form1" method="post" action="<{$formUrl}>">
                <{if $info.id != ""}><input id="id" type="hidden" name="id" value="<{$info.id}>" /><{/if}>

                <fieldset>

                    <p>
                        <label>文章标题</label>
                        <input class="text-input medium-input" type="text" id="medium-input" name="title" value="<{$info.title}>" />
                    </p>
                    <p>
                        <label>缩略名&nbsp;&nbsp;<font color="red">*</font></label>
                        <input class="text-input small-input" type="text" id="slug" name="slug" value="<{$info.slug}>" />
                        <span id="exresult"></span> &nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="checkbox" name="allowCommend" value="1" <{if $info.allowCommend == "1"}> checked <{/if}> />
                               推荐
                               <input type="checkbox" name="status" value="1" <{if $info.status == "1"}> checked <{/if}> />
                               隐藏
                               <input type="checkbox" name="public" value="1" <{if $info.public == "1"}> checked <{/if}> />
                               公开
                               <input class="text-input" style="width:30px;" type="text" id="small-input2" name="sort" value="<{$info.sort}>" />
                        权重
                        <br />
                    </p>

                    <p>
                        <label>形象图</label>
                        <input class="text-input medium-input" type="text" id="medium-input2" name="thumb" value="<{$info.thumb}>" />
                    </p>

                    <p>
                        <label>文章类别</label>
                        <select name="parent" class="small-input">
                            <{if 0 == $select}>
                            <option value="">暂无分类</option>
                            <{else}>
                            <!--循环显示分类-->
                            <option value="">请选择文章分类</option>
                            <{foreach from=$select item=result}>
                            <option value="<{$result.id}>"<{if $info.parent == $result.id}> selected="selected" <{/if}>><{$result.name}></option>
                            <{/foreach}>
                            <{/if}>
                        </select>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        文章发布时间：<input class="text-input" style="width:120px;" type="text" id="medium-input" name="created" value="<{if $info.created == ""}> <{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}><{/if}><{$info.created}>" />
                    </p>

                    <p>
                        <label>编辑文章描述</label>
                        <textarea class="text-input textarea" id="textfield" name="overview" cols="79" rows="3"><{$info.overview}></textarea>
                    </p>

                    <p>
                        <label>编辑文章内容</label>
                        <textarea class="text-input textarea" id="textarea" name="text" cols="79" rows="15"><{$info.text}></textarea>
                    </p>

                    <p>
                        <input class="button" type="submit" value="发表文章" />
                    </p>

                </fieldset>

                <div class="clear"></div><!-- End .clear -->

            </form>

        </div> <!-- End .content-box-content -->

    </div> <!-- End .content-box --><!-- End .content-box --><!-- End .content-box -->
    <div class="clear"></div>
    <{include file="admin/footer.html"}>